/**
 * Created by Mark_ren on 2016/11/7.
 * 苟富贵,無相忘
 */
var express = require('express');
var router = express.Router();
var moment = require("moment");

var co = require('co');
var seqModule = require('./createModules');
var seq = new seqModule();

//添加百问百答问题
router.get('/addWJLog', function(req, res, next) {
    co(function () {
        // var insertSql="insert into wj_log (id, num_one, num_two, num_three, num_four, num_five, open_id, member_name, hospital_name) VALUES ";
        //
        // insertSql+="('"+req.query.id+"','"+req.query.numOne+"','"+req.query.numTwo+"','"+req.query.numThree+"','"+req.query.numFour+"','"+
        //             req.query.numFive+"','"+req.query.openId+"','"+req.query.memberName+"','"+req.query.hospitalName+"')";
        // //req.memberName = decodeURI(req.query.memberName);
        // // seq.sequelize.query(insertSql).then(function(results){
        // //
        // // });
        req.query.numOne =  decodeURI(req.query.numOne);
        req.query.numTwo =  decodeURI(req.query.numTwo);
        req.query.numThree =  decodeURI(req.query.numThree);
        req.query.numFour =  decodeURI(req.query.numFour);
        req.query.numFive =  decodeURI(req.query.numFive);
        req.query.numSix =  decodeURI(req.query.numSix);
		req.query.numEight =  decodeURI(req.query.numEight);
        req.query.numTen =  decodeURI(req.query.numTen);
        req.query.memberName =  decodeURI(req.query.memberName);
        req.query.hospitalName =  decodeURI(req.query.hospitalName);
        req.query.numSeven = decodeURI(req.query.numSeven);
        seq.questionireModule.create(req.query).then(function(results){
            res.json({"success":true,"result":results});
        });
    }).catch(function(e) {
        res.json({'success':false,'msg':'添加失败'});
        console.log(e);
    })
});

module.exports = router;